﻿namespace LookupWithPicker
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.SharePoint.ApplicationPages;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.Utilities;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Collections;
    using System.IO;

    public class LookupWithPickerFieldEditor : LookupFieldEditor
    {
        /* NOT READY YET
        protected void DdlLookupFieldTargetList_Changed2(object sender, EventArgs e)
        {
            SPWeb contextWeb = SPControl.GetContextWeb(this.Context);
            this.PopulateShowFieldDropDown2(this.DdlLookupFieldTargetField, contextWeb.Lists[new Guid(this.DdlLookupFieldTargetList.SelectedValue)], this.OwnerListId, null, null);
            this.Page.SetFocus(this.DdlLookupFieldTargetList);
        }

        private void PopulateShowFieldDropDown2(DropDownList showField, SPList lookupTolist, Guid ownerListId, string strSelectedField, string[] excludedShowFields)
        {
            showField.Items.Clear();
            foreach(SPField field in lookupTolist.Fields)
            {
                if (!field.Hidden && !field.Type.Equals(SPFieldType.Attachments))
                {
                    string extraText = null;
                    ListItem item = new ListItem
                    {
                        Text = field.Title + " " + field.AuthoringInfo + " "
                    };
                    if (!string.IsNullOrEmpty(extraText))
                    {
                        item.Text = item.Text + extraText;
                    }
                    item.Value = field.InternalName;
                    if (field.InternalName == strSelectedField)
                    {
                        item.Selected = true;
                    }
                    showField.Items.Add(item);
                }
            }
        }
        */
    }
}
